home *** CD-ROM | disk | FTP | other *** search
/ Champak 114 / Vol 114.iso / games / harry_po.swf / scripts / frame_14 / DoAction_2.as next >
Encoding:
Text File  |  2010-08-12  |  1.0 KB  |  38 lines

  1. function fnOpenHighScores()
  2. {
  3.    getURL(sw10,"_self");
  4. }
  5. function fnPostHighScore(score)
  6. {
  7.    postClip.score = score;
  8.    postClip.score2 = fnCalcHash(gScore);
  9.    if(debug == "yes")
  10.    {
  11.       debug_mc.debugstring += "SENDING SCORE " + postClip.score + " and hash " + postClip.score2 + " to " + sw4;
  12.    }
  13.    postClip.sendAndLoad(sw4,varReceiver,"POST");
  14. }
  15. function fnCalcHash(score)
  16. {
  17.    var hash;
  18.    var x = Math.sin(score + 5774).toString();
  19.    trace("Sin is " + x);
  20.    var pindx = x.indexOf(".") + 1;
  21.    hash += x.slice(pindx + 5,pindx + 6);
  22.    hash += x.slice(pindx + 4,pindx + 5);
  23.    hash += x.slice(pindx + 3,pindx + 4);
  24.    hash += x.slice(pindx + 2,pindx + 3);
  25.    hash += x.slice(pindx + 1,pindx + 2);
  26.    hash += x.slice(pindx,pindx + 1);
  27.    trace("Hash is " + hash);
  28.    return hash;
  29. }
  30. if(debug == "yes")
  31. {
  32.    debug_mc.debugstring += " SWF4: " + gameMC.sw4;
  33.    debug_mc.debugstring += " SWF10: " + gameMC.sw10;
  34.    debug_mc.debugstring += " SWF2: " + gameMC.sw2;
  35. }
  36. var postClip = new LoadVars();
  37. var varReceiver = new LoadVars();
  38.